<?php

namespace app\api\controller;

use app\admin\model\Banner as ModelBanner;
use app\common\controller\Api;

class Banner extends api
{
    /**
     * 无需登录的方法,同时也就不需要鉴权了
     * @var array
     */
    protected $noNeedLogin = ['*'];

    /**
     * 无需鉴权的方法,但需要登录
     * @var array
     */
    protected $noNeedRight = ['*'];
    /**
     * 获取轮播图列表
     */
    public function getBannerList()
    {
        $where = ['status' => '1', 'deletetime' => null];
        $banners = ModelBanner::where($where)->order('weigh desc,id desc')->field('id,image')->select();
        if ($banners) {
            $this->success('获取成功', $banners);
        } else {
            $this->error('获取失败');
        }
    }
}
